/*
 *  linkage.h
 *  Sandbox
 *
 *  Created by Joshua Lewis on 10/28/10.
 *  A parallel single linkage algorithm using OpenMP.
 *
 */

#ifndef LINKAGE_H
#define LINKAGE_H

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>

#include <omp.h>

#include "sort.h"

typedef struct {
	int i;
	int j;
	float distance;
} dendrite;

int compareFloat(const void *a, const void *b);
int compareDendrite(const void *a, const void *b);

void nodist_dendrogram(int N, int remainSize, dendrite *sorted, dendrite *result);
void comp(int N, float *distance, dendrite *result);
void dendrogram(int N, float *distance, dendrite *result);
void denSlow(int N, float *distance, dendrite *result);
void denSlow2(int N, float *distance, dendrite *result);
int prune(dendrite *part, int N, int size);

void assignLaunch(dendrite *dendrogram, int k, int N, int *result);
void assign(dendrite *dendrogram, int line, int k, int N, int *result);

#endif